package com.xpc.rpc.common.enums;

public enum RpcMsgType {

    /**
     * 请求消息
     */
    REQUEST(1),

    /**
     * 响应消息
     */
    RESPONSE(2);

    private final int type;

    RpcMsgType(int type) {
        this.type = type;
    }

    public static RpcMsgType findByType(int type) {
        for (RpcMsgType rpcType : RpcMsgType.values()) {
            if (rpcType.getType() == type) {
                return rpcType;
            }
        }
        return null;
    }

    public int getType() {
        return type;
    }
}
